1   /*
2    * Copyright (c) 2004-2005, University Health Network.  All rights reserved. Distributed under the BSD 
3    * license (see http://opensource.org/licenses/bsd-license.php).
4    *  
5    * InvokeZeroOrMoreMatcher.java
6    *
7    * Created on 10-Dec-2004 at 12:44:18 PM
8    */
9   package ca.uhn.cache.util;
10  
11  import org.jmock.core.Invocation;
12  import org.jmock.core.matcher.InvokedRecorder;
13  
14  
15  /***
16   * Allows a method to eb invoked zero or more times. 
17   * 
18   * @author <a href="mailto:alexei.guevara@uhn.on.ca">Alexei Guevara</a>
19   * @version $Revision: 1.1 $ updated on $Date: 2005/01/24 22:52:01 $ by $Author: bryan_tripp $
20   */
21  public class InvokeAnyMatcher extends InvokedRecorder {
22  
23      /***
24       * {@inheritDoc}
25       */
26      public boolean matches( Invocation theInvocation ) {
27          return true;
28      }
29  
30      /***
31       * {@inheritDoc}
32       */
33      public void verify() {
34      }
35  
36      /***
37       * {@inheritDoc}
38       */
39      public boolean hasDescription() {
40          return true;
41      }
42  
43      /***
44       * {@inheritDoc}
45       */
46      public StringBuffer describeTo( StringBuffer theBuffer ) {
47          theBuffer.append("expected zero or more");
48          if (hasBeenInvoked()) {
49              theBuffer.append(" and has been invoked");
50          }
51          return theBuffer;
52      }
53  
54  }